package com.xxxtea.sdk.amap;

import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.List;

/**
 * 高德地图API返回结果对象
 * 
 * 封装高德地图Web服务API的返回结果，包括：
 * - 基础返回信息（状态、数量、说明）
 * - 地理编码结果
 * - 逆地理编码结果
 * - 路线规划结果
 * 
 * 包含多个内部类用于表示不同类型的地理信息
 * 
 * @author badman
 * @since 1.0.0
 */
@Data
@ApiModel("高德地图api返回结果")
public class AmapResult {

	@ApiModelProperty("返回结果状态值")
	private String status;

	@ApiModelProperty("返回结果数目")
	private String count;

	@ApiModelProperty("返回状态说明")
	private String info;

	@ApiModelProperty("地理编码信息列表")
	private List<Geocode> geocodes;

	@ApiModelProperty("逆地理编码信息")
	private Regeocode regeocode;

	@ApiModelProperty(value = "路线信息列表")
	private Route route;

	/**
	 * 地理编码信息类
	 * 
	 * 用于封装地址正地理编码的返回结果
	 * 
	 * @author badman
	 * @since 1.0.0
	 */
	@Data
	@ApiModel("地理编码信息")
	public static class Geocode {

		@JsonProperty("formatted_address")
		@ApiModelProperty("格式化地址")
		private String formattedAddress;

		@ApiModelProperty("国家")
		private String country;

		@ApiModelProperty("省份")
		private String province;

		@ApiModelProperty("城市编码")
		private String citycode;

		@ApiModelProperty("城市")
		private String city;

		@ApiModelProperty("区")
		private String district;

		@ApiModelProperty("街道")
		private String street;

		@ApiModelProperty("门牌号")
		private String number;

		@ApiModelProperty("区域编码")
		private String adcode;

		@ApiModelProperty("坐标点")
		private String location;

		@ApiModelProperty("匹配级别")
		private String level;

		@ApiModelProperty("乡镇")
		private List<String> township;

		@ApiModelProperty("社区信息")
		private Neighborhood neighborhood;

		@ApiModelProperty("建筑信息")
		private Building building;

		/**
		 * 社区信息类
		 * 
		 * @author badman
		 * @since 1.0.0
		 */
		@Data
		@ApiModel("社区信息")
		public static class Neighborhood {
			@ApiModelProperty("社区名称")
			private List<String> name;

			@ApiModelProperty("社区类型")
			private List<String> type;
		}

		/**
		 * 建筑信息类
		 * 
		 * @author badman
		 * @since 1.0.0
		 */
		@Data
		@ApiModel("建筑信息")
		public static class Building {
			@ApiModelProperty("建筑名称")
			private List<String> name;

			@ApiModelProperty("建筑类型")
			private List<String> type;
		}
	}

	/**
	 * 逆地理编码信息类
	 * 
	 * 用于封装经纬度逆地理编码的返回结果
	 * 
	 * @author badman
	 * @since 1.0.0
	 */
	@Data
	@ApiModel("逆地理编码信息")
	public static class Regeocode {

		@ApiModelProperty("地址元素列表")
		private AddressComponent addressComponent;

		@ApiModelProperty("商圈信息列表")
		private List<BusinessArea> businessAreas;

		/**
		 * 地址元素类
		 * 
		 * 包含详细的地址组成信息
		 * 
		 * @author badman
		 * @since 1.0.0
		 */
		@Data
		@ApiModel("地址元素")
		public static class AddressComponent {

			@ApiModelProperty("国家")
			private String country;

			@ApiModelProperty("省份")
			private String province;

			@ApiModelProperty("城市")
			private String city;

			@ApiModelProperty("城市编码")
			private String citycode;

			@ApiModelProperty("区")
			private String district;

			@ApiModelProperty("行政区编码")
			private String adcode;

			@ApiModelProperty("乡镇/街道")
			private String township;

			@ApiModelProperty("乡镇/街道编码")
			private String towncode;

			@ApiModelProperty("社区信息")
			private Neighborhood neighborhood;

			@ApiModelProperty("建筑信息")
			private Building building;

			@ApiModelProperty("街道信息")
			private StreetNumber streetNumber;

			@ApiModelProperty("海域信息")
			private String seaArea;

			/**
			 * 社区信息类
			 * 
			 * @author badman
			 * @since 1.0.0
			 */
			@Data
			@ApiModel("社区信息")
			public static class Neighborhood {
				@ApiModelProperty("社区名称")
				private List<String> name;

				@ApiModelProperty("社区类型")
				private List<String> type;
			}

			/**
			 * 建筑信息类
			 * 
			 * @author badman
			 * @since 1.0.0
			 */
			@Data
			@ApiModel("建筑信息")
			public static class Building {
				@ApiModelProperty("建筑名称")
				private List<String> name;

				@ApiModelProperty("建筑类型")
				private List<String> type;
			}

			/**
			 * 街道信息类
			 * 
			 * @author badman
			 * @since 1.0.0
			 */
			@Data
			@ApiModel("街道信息")
			public static class StreetNumber {
				@ApiModelProperty("街道名称")
				private String street;

				@ApiModelProperty("门牌号")
				private String number;

				@ApiModelProperty("坐标点")
				private String location;

				@ApiModelProperty("方向")
				private String direction;

				@ApiModelProperty("距离")
				private String distance;
			}
		}

		/**
		 * 商圈信息类
		 * 
		 * @author badman
		 * @since 1.0.0
		 */
		@Data
		@ApiModel("商圈信息")
		public static class BusinessArea {
			@ApiModelProperty("商圈中心点经纬度")
			private String location;

			@ApiModelProperty("商圈名称")
			private String name;

			@ApiModelProperty("商圈所在区域编码")
			private String id;
		}
	}

	/**
	 * 路线信息类
	 * 
	 * 用于封装路线规划的返回结果
	 * 
	 * @author badman
	 * @since 1.0.0
	 */
	@Data
	@ApiModel(description = "路线信息")
	public static class Route {
		@ApiModelProperty(value = "起点坐标", example = "116.481028,39.989643")
		private String origin;

		@ApiModelProperty(value = "终点坐标", example = "116.434446,39.90816")
		private String destination;

		@ApiModelProperty(value = "步行方案列表")
		private List<Path> paths;
	}

	/**
	 * 步行方案类
	 * 
	 * 包含具体的步行路线信息
	 * 
	 * @author badman
	 * @since 1.0.0
	 */
	@Data
	@ApiModel(description = "步行方案")
	public static class Path {
		@ApiModelProperty(value = "起点和终点的步行距离（米）", example = "1000")
		private int distance;

		@ApiModelProperty(value = "步行时间预计（秒）", example = "600")
		private int duration;

		@ApiModelProperty(value = "步行结果列表")
		private List<Step> steps;
	}

	/**
	 * 步行步骤类
	 * 
	 * 包含每个步行路段的详细信息
	 * 
	 * @author badman
	 * @since 1.0.0
	 */
	@Data
	@ApiModel(description = "步行步骤")
	public static class Step {
		@ApiModelProperty(value = "路段步行指示", example = "向北走")
		private String instruction;

		@ApiModelProperty(value = "道路名称", example = "松岗大街")
		private String road;

		@ApiModelProperty(value = "此路段距离（米）", example = "200")
		private int distance;

		@ApiModelProperty(value = "方向", example = "北")
		private String orientation;

		@ApiModelProperty(value = "此路段预计步行时间（秒）", example = "120")
		private int duration;

		@ApiModelProperty(value = "此路段坐标点", example = "113.384822,23.159285")
		private String polyline;

		@ApiModelProperty(value = "步行辅助动作", example = "通过人行横道")
		private String assistantAction;
	}
}
